<?php

if (isset($_POST['OBJCTCL'])) {
    $OBJCTCL = $_POST['OBJCTCL'];
    $MDCL = 'ED';
} else {
    echo '<script charset="utf-8" type="text/javascript">
			document.getElementById(\'PrfGfx\').src=\'_response/bin.php?get=Profiles/Cl/prf01.png\';
                        </script>';
}
$CLPRF2 = '&lt;Sem Incidencias&gt;';
$CLPROFILE = $MYT->db_array("SELECT
			b.REF,
			b.EventLevel,
			hc_st.VALUE,
			hc_st.FILE
			 FROM clientes
			LEFT OUTER JOIN hc_profiles AS b ON b.SENDER = CliNumero
			LEFT OUTER JOIN hcw_profilesetts AS hc_st ON hc_st.REF = b.TYPE AND hc_st.TYPE = 1
			WHERE CliNumero = {$OBJCTCL}");

if (isset($CLPROFILE[1])) {

    $CLPRF1 = $CLPROFILE[1]['VALUE'];
    if ($CLPROFILE[1]['EventLevel'] != 0) {
        echo '<script charset="utf-8" type="text/javascript">
			document.getElementById(\'PrfGfx\').src=\'_response/bin.php?get=Profiles/Cl/' . $CLPROFILE[1]['FILE'] . '\';
			</script>';
    }
} else {
    $CLPROFILE[1]['REF'] = 1;
}
$CLEVENTS = $MYT->db_array("SELECT * FROM hc_prfalerts
				WHERE RefClient = {$OBJCTCL} ORDER BY REF DESC");
for ($e = 1; $e <= $CLEVENTS[0]; $e++) {
    if ($e == 1) {
        $CLPRF2 = '<a href="#">HistÓrico</a> | ' . $CLEVENTS[$e]['Msg'];
    }
}

echo 'Perfil:' . rt_field('select', $MDCL, 'CliProfile', $CLPROFILE[1]['REF'], "SELECT REF AS ID, VALUE AS NAME FROM hcw_profilesetts", '', 'False', '');
echo '<div class="Line">' . $CLPRF2 . '</div>';
?>